package initialize

import (
	"github.com/go-redis/redis"
	"go-gin-admin/global"
)

func Redis()  {
	redisCfg := global.GVA_CONFIG.Redis
	client := redis.NewClient(&redis.Options{
		Addr: redisCfg.Addr,
		Password: redisCfg.Password,
		DB: redisCfg.DB,
	})
	pong,err := client.Ping().Result()
	if err != nil {
		global.GVA_LOG.Error(err)
	}else {
		global.GVA_LOG.Info("redis 连接成功",pong)
		global.GVA_REDIS = client
	}
}
